﻿using DGZImp.Core.DbSqlSugar;
using DGZImp.Core.EFDbContext;
using DGZImp.Core.Utilities.Response;
using DGZImp.MdsProject.Devices;
using DGZImp.MdsProject.Devices.Base;
using DGZImp.MdsProject.Devices.Entities;
using DGZImp.MdsProject.Devices.Models;
using DGZImp.MdsProject.DomainModels;
using DGZImp.MdsProject.Models;
using DGZImp.WmsProject.IServices;
using Nomad.Iot.Profinet.Siemens;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace DGZImp.MdsProject.Services
{
    public class MdsCommonService : IMdsCommonService, ISingleton
    {
        public ISqlSugarClient Db = AutofacContainerModule.GetService<ServiceDbContext>().SqlSugarClient;
        public MdsInit MdsInit = AutofacContainerModule.GetService<MdsInit>();

        public async Task<List<PropsItem>> GetMdsDataPropsByCategory(int? category)
        {
            if (category == null) return new List<PropsItem>();
            return await MdsInit.GetDataProps((RealDeviceTypeEmun)category);
        }

        public async Task<ResMdsDeviceData> GetMdsDeviceData(long? RealDeviceId)
        {
            return await MdsInit.GetDeviceData(RealDeviceId);
        }

        public async Task<object> ExecuteMdsDeviceAction(ReqExecuteAction req)
        {
            return await MdsInit.ExecuteAction(req);
        }

    }
}
